package com.dubbo.test.consumer;

import org.apache.dubbo.config.spring.context.annotation.EnableDubbo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Auther: liuyj
 * @Date: 2021/09/07/10:30
 * @Description:
 */
@EnableDubbo
@SpringBootApplication
public class DubboConsumerApplication {
    public static void main(String[] args) {
        SpringApplication.run(DubboConsumerApplication.class,args);
    }

    @RestController
    class MyController {
        final DemoServiceImpl demoService;
        public MyController(DemoServiceImpl demoService) {
            this.demoService = demoService;
        }
        @RequestMapping("/hello")
        public String hello(@RequestParam("name") String name){
            return demoService.sayHello(name);
        }
    }
}
